package br.com.zynger.mst.addressbook;

import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SpringLayout;

//Refactoring 6: Extract superclass
public class SearchForm extends FormFrame {

	private static final long serialVersionUID = 1L;

	private JTextField firstNameTextField;
	private JTextField lastNameTextField;
	
	//Refactoring 5: Extract class
	public SearchForm() {
		super.init("Search", 400, 150);
		
		JPanel panel = new JPanel(new SpringLayout());
		firstNameTextField = createFormField(panel, "First Name:");
		lastNameTextField = createFormField(panel, "Last Name:");
		
		addFormGrid(panel, 2);
	}
	
	public String getFirstNameTextFieldValue(){
		return firstNameTextField.getText().toString().trim();
	}
	
	public String getLastNameTextFieldValue(){
		return lastNameTextField.getText().toString().trim();
	}	
}
